import request from '@/request/index.js'
import {C2B} from '@/utils/wordtransfer.js'

// 查询搜索并分页
export const findMenuRoot = (data = {}) => {
   return request.post("/sysapis/root",data)
}

// 查询搜索并分页
export const findPages = (data= {}) => {
   return request.post("/sysapis/list",data)
}

/**
 * 查询菜单列表并分页
 */
export const loadTreeData = (data= {keyword:""})=>{
   return request.post(`/sys/menus/tree?keyword=${data.keyword}`,data)
}

// 保存和更新
export const saveUpdate = (data= {}) => {
   return request.post("/sysapis/saveupdate",data)
}

// id查询明细
export const getById = (id) => {
   return request.post(`/sysapis/get/${id}`,{})
}

// id删除
export const delById = (id) => {
   return request.post(`/sysapis/del/${id}`,{})
}

// 修改状态
export const updateStatus = (id,field,value) => {
   field = C2B(field)
   return request.post(`/sysapis/status/${id}/${field}/${value}`,{})
}